package com.urun.interceptor.hotanalysis.service;

import com.urun.interceptor.hotanalysis.DTO.ClassifwordSearchDTO;
import com.urun.interceptor.hotanalysis.bean.Classifyword;

import com.urun.interceptor.hotanalysis.mapper.db1.ClassifwordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ClassifywordService {
    @Autowired
    ClassifwordMapper classifwordMapper;
    @Transactional
    public List<Classifyword> findWord(String SystemID,String CompanyID){
        List<Classifyword> wordList = classifwordMapper.findWord(SystemID, CompanyID);
        return wordList;
    }

    public boolean saveClassifyWord(Classifyword classifyword){
        return classifwordMapper.saveClassifyWord(classifyword);
    }

    public List<ClassifwordSearchDTO> searchClassifWord(String SystemID,String CompanyID){
        return classifwordMapper.searchClassifWord(SystemID,CompanyID);
    }

    public ClassifwordSearchDTO selectClassifyWordById(String id){
        return classifwordMapper.selectClassifyWordById(id);

    }

    @Transactional
    public boolean EditClassifyword(ClassifwordSearchDTO searchDTO) {
        boolean b = classifwordMapper.EditClassifyword(searchDTO);
        if (!b){
            throw new RuntimeException();
        }

        return b;
    }
}
